#include<stdio.h>
# define M 5
# define N 3
struct student{
	long num;
	char name[20];
	int score[N];
	double ave;
};
void sr(struct student a[])
{
	int i;
	for(i=0;i<M;i++)
	{
		scanf("%ld",&a[i].num);
		getchar();
		gets(a[i].name);
		int j,b;
		for(j=b=0;j<N;j++)
		{
			scanf("%d",&a[i].score[j]);
			b=b+a[i].score[j];
		}
		a[i].ave=(double)b/N;
	}
}
void sc(struct student b[])
{
	int i;
	for(i=0;i<M;i++)
	{
		printf("%ld,",b[i].num);
		
		printf("%s",b[i].name);
		//puts(b[i].name);
		printf(",");
		int j=0;
		for(j=0;j<N;j++)
		printf("%d,",b[i].score[j]);
		printf("%.2lf",b[i].ave);
		printf("\n");
	}
	
}
void promax(struct student c[])
{
	int i,j;
	for(i=0;i<M;i++)
	{
		if(c[0].ave<c[i].ave)
		{
			c[0].ave=c[i].ave;
			j=i;
		}
			
	}
	printf("%ld,",c[j].num);
	printf("%s",c[j].name);
	printf(",");
	//int i=0;
	for(i=0;i<N;i++)
	printf("%d,",c[j].score[i]);
	printf("%.2lf",c[0].ave);
}
int main()
{
	struct student a[M];
	sr(a);
	sc(a);
	promax(a);
	return 0;
}
/*
#include <stdio.h>
#include <string.h>

#define M 5
#define N 3

typedef struct {
    int id;
    char name[50];
    int scores[N];
} Student;

void inputStudents(Student students[]) {
	int i,j;
    for (i = 0; i < M; i++) {
        scanf("%d", &students[i].id);
        getchar();
        scanf("%s", students[i].name);
        for (j = 0; j < N; j++) {
            scanf("%d", &students[i].scores[j]);
        }
    }
}

void calculateAverages(Student students[]) {
	int i,j;
    for (i = 0; i < M; i++) {
        float sum = 0;
        for (j = 0; j < N; j++) {
            sum += students[i].scores[j];
        }
        float average = sum / N;
        printf("%d,%s,%d,%d,%d,%.2f\n", students[i].id, students[i].name, students[i].scores[0], students[i].scores[1], students[i].scores[2], average);
    }
}

void findHighestAverage(Student students[]) {
    int maxIndex = 0;
    float maxAverage = 0;
    int i,j;
    for (i = 0; i < M; i++) {
        float sum = 0;
        for (j = 0; j < N; j++) {
            sum += students[i].scores[j];
        }
        float average = sum / N;
        if (average > maxAverage) {
            maxAverage = average;
            maxIndex = i;
        }
    }
    printf("%d,%s,%d,%d,%d,%.2f\n", students[maxIndex].id, students[maxIndex].name, students[maxIndex].scores[0], students[maxIndex].scores[1], students[maxIndex].scores[2], maxAverage);
}

int main() {
    Student students[M];
    inputStudents(students);
    calculateAverages(students);
    findHighestAverage(students);
    return 0;
}*/
